<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>商家首页</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="{$smarty.const.PUBLIC_PATH}css/amazeui.min.css"/>
<link rel="stylesheet" href="{$smarty.const.IMAGES_PATH}style.css"/>
<script src="{$smarty.const.PUBLIC_PATH}js/jquery.min.js"></script>
<script src="{$smarty.const.PUBLIC_PATH}js/amazeui.min.js"></script>
</head>

<body>
<div class="container">
	<header data-am-widget="header" class="am-header am-header-default my-header">
      <div class="am-header-left am-header-nav am-dropdown"  data-am-dropdown style="display:none">
        <a href="javascript:;" class="am-dropdown-toggle"  data-am-dropdown-toggle>
          <i class="am-header-icon am-icon-th-large"></i>
        </a>
        <div style="display:none">

        </div>
        <ul class="am-dropdown-content">
           <li><a href="#">关于我们</a></li>
            <li><a href="#">新闻中心</a></li>
            <li><a href="#">团购</a></li>
            <li><a href="#">商城</a></li>
            <li><a href="#">收银台</a></li>
            <li><a href="#">相册</a></li>
            <li><a href="#">视频</a></li>
          </ul>
      </div>
      <h1 class="am-header-title">
        <a href="#title-link" class="">商城首页</a>
      </h1>
      <div class="am-header-right am-header-nav" style="display:none">
        <a href="#right-link" class="">
          <i class="am-header-icon  am-icon-share-alt"></i>
        </a>
      </div>
    </header>
    <!-- banner -->
    <div data-am-widget="slider" class="am-slider am-slider-a1" data-am-slider='{ &quot;directionNav&quot;:false}'>
      <ul class="am-slides">
        {foreach $slides as $k=>$v}
        <li>
        	<a href="{$v.link}">
          <img src="{$v.image}">
          </a>
        </li>
        {/foreach}
      </ul>
    </div>
    <!--搜索框-->
    <div class="gray-panel">
    	<div class="my-search-title-panel">
        	<div class="am-input-group">
              <input type="text" class="am-form-field am-radius" name="keyword" id="keyword">
              <span class="am-input-group-btn">
                <button class="am-btn am-radius submit" type="submit" ><span class="am-icon-search"></span></button>
              </span>
            </div>
        </div>
    </div>
    <div class="am-cf am-g my-shop-nav" style="display: none;">
    	<div class="my-shop-nav-panellf">
        	<div class=" my-shop-nav-img am-circle ">
        	<img src="{$smarty.const.IMAGES_PATH}img1.jpg" class="am-circle m-img-thumbnail" />
            </div>
        </div>
        <div class="my-shop-nav-panelrt am-fr">
        	<ul class="am-nav am-nav-pills my-shop-nav-ul">
            	<li><a href="#">关于我们</a></li>
                <li><a href="#">新闻中心</a></li>
                <li><a href="#">团购</a></li>

            </ul>
        </div>
    </div>
    
    <div class="am-cf am-g">
    	<ul class="am-avg-sm-2 my-shop-product-list">
        	{foreach $goods as $k=>$v}
        	<li>
        		<a href="{$smarty.const.__CONTROLLER__}/goodsdetail/id/{$v.id}">
            	<div class="am-panel am-panel-default">
                    <div class="am-panel-bd">
                    	<img class="am-img-responsive" src="{$v.main_img}" />
                        <h3 style="text-align: center;">{$v.name}</h3>
                        <div>
                            <span class="list-product-price-span" style="color:#8f8f8f;font-size: 12px;"><del>{$v.ori_price}积分</del></span>
                            <span class="list-product-commission-span" style="color:#e00000;font-size: 15px;">{$v.price}积分</span>
                            <span class="list-product-sorce-span">剩余<br/>{$v.count}</span>
                        </div>
                        <hr data-am-widget="divider" style="" class="am-divider am-divider-default am-cf"/>
                        <ol class="am-avg-sm-3 product-list-share">
                            <li><a class="am-secondary am-icon-md {if $v.info==1}am-icon-thumbs-o-up{/if}" style="color:lightseagreen;"></a></li>
                            <li><a data-id="{$v.id}" class="addshopcart am-secondary am-icon-md am-icon-shopping-cart" style="color: #0e90d2;"></a></li>
                            <li><a data-id="{$v.id}" class="fav am-secondary am-icon-md am-icon-star {if !in_array($v.id, $idstr)}am-icon-star-o{/if}" style="color: greenyellow;"></a></li>
                        	
                        </ol>
                    </div>
                </div>
                </a>
            </li>
            {/foreach}
        </ul>
    </div>
    
    
    <footer data-am-widget="footer" class="am-footer am-footer-default" data-am-footer="{  }">
        <hr data-am-widget="divider" style="" class="am-divider am-divider-default"/>
      <div class="am-footer-miscs ">
        <p>京ICP备13033158</p>
      </div>
    </footer>
    <!--底部-->
    {include file="../footer.html"}
</div>
<script>
	$('.fav').click(function(){
		//登录后才可以收藏
		{if $smarty.session.id==null}
			window.location.href="{$smarty.const.__MODULE__}/User/integrallogin";
			// window.navigate("myshop/index.php/User/integrallogin.html");
		{/if}
		var thisgoods=$(this);
		var data={
			id:thisgoods.data('id'),
		}
		$.post("{$smarty.const.__CONTROLLER__}/goodsfav", data, function(ret){
			console.log(ret);
			if(ret){
				thisgoods.removeClass('am-icon-star-o');
//				alert("收藏了");
			}else{
				thisgoods.addClass('am-icon-star-o');
//				alert("取消了");
			}
		})
	})
	$('.addshopcart').click(function(){
		//登录后才可以添加购物车
		{if $smarty.session.id==null}
			window.location.href="{$smarty.const.__MODULE__}/User/integrallogin";
			// window.navigate("myshop/index.php/User/integrallogin.html");
		{/if}
		var thisgoods=$(this);
		var data={
			id:thisgoods.data('id'),
		}
		$.post("{$smarty.const.__CONTROLLER__}/addshopcart", data, function(ret){
			console.log(ret);
			if(ret){
//				thisgoods.removeClass('am-icon-star-o');
				alert("加入购物车成功");
			}else{
//				thisgoods.addClass('am-icon-star-o');
				alert("加入购物车失败");
			}
		})
	})
	$('.submit').click(function(){
		window.location.href="{$smarty.const.__CONTROLLER__}/search/keyword/"+$('#keyword').val();
//		alert("{$smarty.const.__CONTROLLER__}/search/keyword/"+$('#keyword').val());
	})
</script>
</body>
</html>
